<template>
	<view>

		<u--form labelPosition='top' labelWidth='700rpx' :model="formState" name="basic" layout="horizontal"
			:labelCol="{span:7}" :wrapperCol="{span: 13, offset: 0}">
			<u-collapse :value="['1','2','3','4']">
				<u-collapse-item name="1" title="安全交底" icon="https://cdn.uviewui.com/uview/example/cell.png">
					<u-cell-group>
						<u-cell title="1 开工前是否已进行安全交底" :value="CheckJsonArr[0]"></u-cell>
						<u-cell title="2 已提交现场出工人员合照" :value="CheckJsonArr[1]"></u-cell>
						<u-cell title="3 已提交现场施工照片" :value="CheckJsonArr[2]"></u-cell>
						<u-cell title="4 已收工现场照片" :value="CheckJsonArr[3]"></u-cell>
					</u-cell-group>
				</u-collapse-item>
				<u-collapse-item name="2" title="工程质量" icon="https://cdn.uviewui.com/uview/example/keyboard.png">
					<u-cell-group>
						<u-cell title="1 是否符合施工图设计要求" :value="CheckJsonArr[4]"></u-cell>
						<u-cell title="2 电源线、传输线、告警线正确连接" :value="CheckJsonArr[5]"></u-cell>
						<u-cell title="3 布线合理整齐，无裸露、交叉、飞线" :value="CheckJsonArr[6]"></u-cell>
						<u-cell title="4 机架内部和机架之间的所有连线、插头都贴有标签" :value="CheckJsonArr[7]"></u-cell>
						<u-cell title="5 设备安装位置严格按照设计方案执行" :value="CheckJsonArr[8]"></u-cell>
						<u-cell title="6 设备已按规范要求做好接地" :value="CheckJsonArr[9]"></u-cell>
						<u-cell title="7 户外光电缆接头用防水胶泥、胶布包扎，无松动，表面整齐密封，包扎符合规范要求" :value="CheckJsonArr[10]"></u-cell>
						<u-cell title="8 尾纤外观应无损伤，尾纤必须套管保护，不得直接裸露在室外" :value="CheckJsonArr[11]"></u-cell>
					</u-cell-group>
				
				</u-collapse-item>

				<u-collapse-item name="3" title="进度阶段" icon="https://cdn.uviewui.com/uview/example/rate.png">
					<u-cell-group>
						<u-cell title="1 领料进场" :value="CheckJsonArr[12]"></u-cell>
						<u-cell title="2 实施主体工程" :value="CheckJsonArr[13]"></u-cell>
						<u-cell title="3 工程完工" :value="CheckJsonArr[14]"></u-cell>
						<u-cell title="4 整理资料" :value="CheckJsonArr[15]"></u-cell>
						<u-cell title="5 工程验收" :value="CheckJsonArr[16]"></u-cell>
					</u-cell-group>
				</u-collapse-item>
				<u-collapse-item name="3" title="工程量" icon="https://cdn.uviewui.com/uview/example/rate.png">
					<u-cell-group>
						<u-cell title="附挂杆路长度(米)" :value="formState.Num1"></u-cell>
						<u-cell title="附挂钢纹线长度(米)" :value="formState.Num2"></u-cell>
						<u-cell title="附挂光缆(米)" :value="formState.Num3"></u-cell>
						<u-cell title="新建杆路长度(米)" :value="formState.Num4"></u-cell>
						<u-cell title="立杆数(根)" :value="formState.Num5"></u-cell>
						<u-cell title="直埋线路长度(米)" :value="formState.Num6"></u-cell>
						<u-cell title="熔纤数量(根)" :value="formState.Num7"></u-cell>
						<u-cell title="安装交接箱数量(个)" :value="formState.Num8"></u-cell>
						<u-cell title="安装分纤箱数量(个)" :value="formState.Num9"></u-cell>
						<u-cell title="皮缆安装(户)" :value="formState.Num10"></u-cell>
						<u-cell title="其他施工项" :value="formState.Other"></u-cell>
					</u-cell-group>
				</u-collapse-item>
				<u-collapse-item name="3" title="其他" icon="https://cdn.uviewui.com/uview/example/rate.png">
					<u-cell-group>
						<u-cell title="存在问题(需要协调)" :value="formState.Wrong"></u-cell>
					</u-cell-group>
				</u-collapse-item>
				<u-collapse-item name="4" title="工程施工日志照片" icon="https://cdn.uviewui.com/uview/example/image.png">
					<u-album :urls="imagesurls1"></u-album>
				</u-collapse-item>
				<u-collapse-item name="4" title="主要施工环节与隐蔽工程照片" icon="https://cdn.uviewui.com/uview/example/image.png">
					<u-album :urls="imagesurls"></u-album>
				</u-collapse-item>
			</u-collapse>
		</u--form>
		<!-- <u-button type="primary" text="保存" @click="save"></u-button> -->
		<u-notify ref="uNotify"></u-notify>
	</view>
</template>

<script>
	import {
		baseUrl
	} from '@/common/config.js'
	import {
		mapGetters
	} from 'vuex'
	import {
		getbuilddailybyid,
		addbuildsafe,
		getfilebyoutid
	} from '@/common/api.js'
	export default {
		data() {
			return {
				CheckJsonArr: [],
				formState: {}, 
				fileList1: [],
				buildid: null,
				id: null,
				imagesurls: [],
				imagesurls1: [],
				notifyData: {
					message: '保存成功',
					type: 'success',
					color: '#ffffff',
					bgColor: '',
					fontSize: 15,
					duration: 3000,
					safeAreaInsetTop: false
				},
			}
		},
		onLoad(option) {
			this.buildid = option.buildid
			if (option.id)
				this.getdate(option.id)
				this.imagesurls=[]
				this.imagesurls1=[]
				getfilebyoutid(option.id).then(res=>{
					for(var i =0;i<res.length;i++)
					{
						if(res[i].MyType=='主要施工环节与隐蔽工程照片')
						{
							this.imagesurls.push(`${baseUrl}/SysFile/download?id=${res[i].Id}`)
						}
						if(res[i].MyType=='工程施工日志照片')
						{
							this.imagesurls1.push(`${baseUrl}/SysFile/download?id=${res[i].Id}`)
						}
					}
				})
		},

		methods: {

			getdate(id) {
				getbuilddailybyid(id).then(res => {
					this.formState = res
					var arr = this.formState.CheckJson.split('')
					arr.forEach((e,i,array)=>{
						if(e=="1")
						{
							arr[i]="是"
						}
						else
						arr[i]='否'
						
					})
					this.CheckJsonArr=arr
				})
			},

		}
	}
</script>

<style>
  
</style>
